Passed
Push — master ( d4464b...8d34d2 )
by Mathieu
01:55
created

DailyRate.getId   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
1
import {Entity, Column, PrimaryGeneratedColumn, ManyToOne} from 'typeorm';
2
import {Customer} from '../Customer/Customer.entity';
3
import {User} from '../User/User.entity';
4
import {Task} from '../Task/Task.entity';
5
6
@Entity()
7
export class DailyRate {
8
  @PrimaryGeneratedColumn('uuid')
9
  private id: string;
10
11
  @Column({type: 'integer', nullable: false})
12
  private amount: number;
13
14
  @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'})
15
  private createdAt: Date;
16
17
  @ManyToOne(type => User, {nullable: false})
18
  private user: User;
19
20
  @ManyToOne(type => Customer, {nullable: false})
21
  private customer: Customer;
22
23
  @ManyToOne(type => Task, {nullable: false})
24
  private task: Task;
25
26
  constructor(amount: number, user: User, customer: Customer, task: Task) {
27
    this.amount = amount;
28
    this.user = user;
29
    this.customer = customer;
30
    this.task = task;
31
  }
32
33
  public getId(): string {
34
    return this.id;
35
  }
36
37
  public getAmount(): number {
38
    return this.amount;
39
  }
40
41
  public getUser(): User {
42
    return this.user;
43
  }
44
45
  public getTask(): Task {
46
    return this.task;
47
  }
48
49
  public getCustomer(): Customer {
50
    return this.customer;
51
  }
52
53
  public update(
54
    amount: number,
55
    user: User,
56
    customer: Customer,
57
    task: Task
58
  ): void {
59
    this.amount = amount;
60
    this.user = user;
61
    this.customer = customer;
62
    this.task = task;
63
  }
64
}
65